﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
using CrazyTalk.Web.UI;

namespace HK.InHospital.Web
{
    public partial class _Default : BasePage
    {
        private DataTable menuDataTable;
        //private HK.Common.Utils.Menu eidMISMenu;

        protected new void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //eidMISMenu = new HK.Common.Utils.Menu();
                this.DTModule = null;
                menuDataTable = this.DTModule;
                String methodName = Request["method"];
                Type type = this.GetType();
                MethodInfo method = type.GetMethod(methodName);
                if (method == null) throw new Exception("method is null");
                try
                {
                    method.Invoke(this, null);
                }
                catch
                {

                }
            }
            catch
            {
                Response.Redirect("Login.html");
            }


        }
        /// <summary>
        /// 装载系统菜单
        /// </summary>
        public void LoadMenuList()
        {  
            //int i = 0;
            //BaseConfiguration config = BaseConfiguration.Instance;
            //config.GetSetting();

            //string rootMenuID = config.RootMenuID;
            //string strWhere = string.Format(BaseModuleTable.FieldParentID + " = '{0}'", rootMenuID);
            //DataRow[] dataRows = menuDataTable.Select(strWhere, BaseModuleTable.FieldSortCode);

            //if (dataRows.Length > 0)
            //{
            //    foreach (DataRow drMenuItem in dataRows)
            //    {
            //        HK.Common.Utils.MenuItem menuItem = new HK.Common.Utils.MenuItem();
            //        menuItem.Text = drMenuItem[BaseModuleTable.FieldFullName].ToString();
            //        if (i == 0)
            //        {
            //            menuItem.CssClass = "guideexpand";
            //            menuItem.IsDisplayMenuSubItem = true;
            //        }
            //        else
            //        {
            //            menuItem.CssClass = "guidecollapse";
            //            menuItem.IsDisplayMenuSubItem = false;
            //        }

            //        strWhere = string.Format(BaseModuleTable.FieldParentID + " = '{0}'", drMenuItem[BaseModuleTable.FieldID].ToString());
            //        DataRow[] subDataRows = menuDataTable.Select(strWhere, BaseModuleTable.FieldSortCode);

            //        if (subDataRows.Length > 0)
            //        {
            //            foreach (DataRow drSubMenuItem in subDataRows)
            //            {
            //                MenuSubItem menuSubItem = new MenuSubItem();
            //                menuSubItem.Text = drSubMenuItem[BaseModuleTable.FieldFullName].ToString();
            //                menuSubItem.NavigationURL = drSubMenuItem[BaseModuleTable.FieldNavigateUrl].ToString();
            //               menuSubItem.Target = "main_right";
            //               menuSubItem.CssClass = "cs-navi-tab";

            //                menuItem.Items.Add(menuSubItem);
            //            }
            //        }

            //        eidMISMenu.ListItems.Add(menuItem);
            //        i++;
            //    }
            //    string retVal = string.Empty;

            //    retVal = eidMISMenu.RenderContents();

            //    Response.Write(retVal);
            //}

        }

    }
}
